package designMode.strategyPatter.demo;

import java.util.HashMap;
import java.util.Map;

/**
 * 陆离
 * 2023/11/6 11:07:39
 */
//课程管理类 映射的是类名
public class CLassesStrategy {
    public static  final String GUO = "Guo";
    public static  final String GUO1 = "Guo1";
    public static  final String LI = "Li";
    public static  final String WANG = "Wang";
    public static  final String ZHANG = "Zhang";

    private static Map<String, Classes> strategy = new HashMap<String,Classes>();

    static {
        strategy.put(GUO,new Guo());
        strategy.put(GUO1,new Guo());
        strategy.put(LI,new Li());
        strategy.put(WANG,new Wang());
        strategy.put(ZHANG,new Zhang());
    }

    public static Classes get(String classKey){
        if(!strategy.containsKey(classKey)){
            return strategy.get(ZHANG);
        }
        return strategy.get(classKey);
    }
}
